using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HISModels.Entities;

namespace HISModels.Mapping
{
	public class GSCSlipPriceListRelMap : EntityTypeConfiguration<GSCSlipPriceListRel>
	{
		public GSCSlipPriceListRelMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			// Table & Column Mappings
			this.ToTable("GSCSlipPriceListRels");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.GSCSlipDetailId).HasColumnName("GSCSlipDetailId");
			this.Property(t => t.PriceListId).HasColumnName("PriceListId");

			// Relationships
			this.HasOptional(t => t.GSCSlipDetail)
				.WithMany(t => t.GSCSlipPriceListRels)
				.HasForeignKey(d => d.GSCSlipDetailId);
				
			this.HasOptional(t => t.PriceList)
				.WithMany(t => t.GSCSlipPriceListRels)
				.HasForeignKey(d => d.PriceListId);
				
		}
	}
}

